--- sys/compat/linuxkpi/common/src/linux_compat.c.orig
+++ sys/compat/linuxkpi/common/src/linux_compat.c
@@ -1502,6 +1502,9 @@
 	KASSERT(file_count(filp) == 0,
 	    ("File refcount(%d) is not zero", file_count(filp)));
 
+	if (td == NULL)
+		td = curthread;
+
 	error = 0;
 	filp->f_flags = file->f_flag;
 	linux_set_current(td);
